<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.skyline.com" prefix="skyline"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache" />
<title>Insert title here</title>
<%@ include file="/views/include/taglib.jsp"%>
<%@ include file="/views/include/nocachehead.jsp"%>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/pagination.js"></script>
<%--<skyline:ajaxPage firstFunc="firstFunc" pageKey="page"
	url="${pageContext.request.contextPath}/ajaxPage1.html" pageDivId="pageDiv1"
	successFunc="processData1" maxSize="5" errorFunc="doError"
	arcCur="false" curClass="cur1 cur2" curStyle="font-size:12px"
	decStr="%s" normalClass="nor1 nor2" normalStyle="font-size:14px"
	paramStr="param=123" objId="p1" beforeSendFunc="bsf1" completeFunc="cf1" />
--%>
<script type="text/javascript">
paginationSetting={
		firstFunc:"firstFunc",
		pageKey:"page",
		url:"${pageContext.request.contextPath}/ajaxPage1.html",
		pageDivId:"pageDiv1",
		successFunc:"processData1",
		maxSize:"5",
		errorFunc:"doError",
		arcCur:"false",
		curClass:"cur1 cur2",
		curStyle:"font-size:12px",
		decStr:"%s",
		normalClass:"nor1 nor2",
		normalStyle:"font-size:14px",
		paramStr:"param=123",
		objId:"p1",
		beforeSendFunc:"bsf1",
		completeFunc:"cf1"
	};
PaginationUtils.paginationJsGen(paginationSetting);
</script>
<skyline:ajaxPage firstFunc="firstFunc" pageKey="page"
	url="${pageContext.request.contextPath}/ajaxPage2.html" pageDivId="pageDiv2"
	successFunc="processData2" maxSize="6" errorFunc="doError"
	arcCur="false" curClass="cur1 cur2" curStyle="font-size:12px"
	decStr="第%s页" normalClass="nor1 nor2" normalStyle="font-size:14px"
	paramStr="param=123" objId="p2" beforeSendFunc="bsf2" completeFunc="cf2" />
<script type="text/javascript">
jQuery("document").ready(function(){
	p1.firstFunc();
	p2.firstFunc();
});
</script>
</head>
<body>
<script type="text/javascript">
var firstExeBsf1 = true;
var firstExeCf1 = true;
var firstExeBsf2 = true;
var firstExeCf2 = true;
function bsf1(request) {
	if(firstExeBsf1) {
		alert("1th page to gener");
		firstExeBsf1=false;
	}
}
function cf1(request) {
	if(firstExeCf1) {
		alert("1th page gened");
		firstExeCf1=false;
	}
}
function bsf2(request) {
	if(firstExeBsf2) {
		alert("2nd page to gener");
		firstExeBsf2=false;
	}
}
function cf2(request) {
	if(firstExeCf2) {
		alert("2nd page gened");
		firstExeCf2=false;
	}
}
function processData1(data) {
	var list = data.data;
	var length = list.length;
	var str = "";
	for(var i=0; i<length; i++)
		str += '<span id="'+list[i]+'">'+list[i]+'</span>';
	$('#dataDiv1').html(str);
}
function processData2(data) {
	var list = data.data;
	var length = list.length;
	var str = "";
	for(var i=0; i<length; i++)
		str += '<div id="'+list[i]+'">'+list[i]+'</div>';
	$('#dataDiv2').html(str);
}
function processData(data) {
	var list = data.data;
	var length = list.length;
	var str = "";
	for(var i=0; i<length; i++)
		str += '<span id="'+list[i]+'">'+list[i]+'</span>';
	$('#dataDiv').html(str);
}
function doError(request,state) {
	alert(state);
}
</script>
<div id="dataDiv"></div>
<div id="pageDiv"></div>

<div id="dataDiv1"></div>
<div id="pageDiv1"></div>
<div id="dataDiv2"></div>
<div id="pageDiv2"></div>

<button onclick="changeUrl()">change first url</button>
<script type="text/javascript">
function processDataChange(data) {
	var list = data.data;
	var length = list.length;
	var str = "";
	for(var i=0; i<length; i++)
		str += '<span id="'+list[i]+'">'+list[i]+'</span>';
	$('#dataDiv1').html(str);
};
function changeUrl() {
	jQuery.extend(paginationSetting,{url:"${pageContext.request.contextPath}/ajaxPage2.html",successFunc:"processDataChange"});
	PaginationUtils.paginationJsGen(paginationSetting);
	p1.firstFunc();
}
</script>
</body>
</html>